<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: Nikita.Brazhnikov
  Date: 3/4/13
  Time: 12:14 PM
-->
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/facelets"
      xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
    <composite:attribute name="name_field" required="true"/>
    <composite:attribute name="password_field" required="true"/>
    <composite:attribute name="result_status" type="java.lang.Boolean" required="false"/>
    <composite:attribute name="result_descr" type="java.lang.String" required="false"/>
    <composite:attribute name="action" method-signature="java.lang.String action()"/>

    <composite:actionSource name="submit" targets="login_form:check"/>
    <composite:editableValueHolder name="login" targets="login_form:login_field"/>

    <composite:facet name="promt"/>
</composite:interface>

<composite:implementation>
<h:outputScript library="composites/login" name="login.js"/>
    <h:form prependId="false" id="login_form">
        <composite:renderFacet name="promt"/>
        <f:fragment rendered="#{cc.attrs.result_status != null and cc.attrs.result_status == false}">
            <div id="login_status">
                <h:outputText id="login_status_text" value="#{cc.attrs.result_descr}"/>
            </div>
        </f:fragment>
        <h:messages/>
        <h:panelGrid columns="2">
            <h:outputLabel value="Login" for="login_field"/>
            <h:inputText size="20" id="login_field" value="#{cc.attrs.name_field}"/>
            <h:outputLabel value="Password" for="pass_field"/>
            <h:inputSecret id="pass_field" size="20" value="#{cc.attrs.password_field}"/>
        </h:panelGrid>
        <h:commandButton id="check" value="Submit" action="#{cc.attrs.action}" onclick="return checkEmptyLogin('#{cc.clientId}','login_form')"/>

        <div id="user_content">
            <composite:insertChildren/>
        </div>
    </h:form>
</composite:implementation>

</html>